package mt.dummy;

import mt.Order;
import mt.comm.ServerSideMessage;

/**
 * 
 * 
 * @author Grupo45
 */
public class ServerMessage implements ServerSideMessage{
	
	private Type type;
	private String senderNickname;
	private Order order;
	

	/**
	 * The constructor of a message which is being sent from the client
	 * 
	 * @param type represents the type of a message
	 * @param senderNickname represents the nickname of the sender
	 * @param order represents the order to send  
	 */	
	public ServerMessage(Type type, String senderNickname, Order order) {
		this.type = type;
		this.senderNickname = senderNickname;
		this.order = order;
	}
	
	public ServerMessage(Type type, String senderNickname) {
		this.type = type;
		this.senderNickname = senderNickname;
		order=null;
	}

	/**
	 * Gets the type of the message
	 * 
	 * @return type of the message
	 */
	@Override
	public Type getType() {
		return type;
	}

	/**
	 * Gets the sender nickname
	 * 
	 * @return sender's nickname 
	 */
	@Override
	public String getSenderNickname() {
		return senderNickname;
	}

	/**
	 * Gets the order in the message
	 * @return order
	 */
	@Override
	public Order getOrder() {
		return order;
	}

}
